UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lBQXum2/ExSFfoxHAuF6MacuQSvEXy2gFcNWP1ebjkk=' 
WHERE 
  key_id = '46aaeed4c79530f7210531a490f1ccffdb184cac18832a33b22f77676e50973d' 
  AND (
    token = 'lBQXum2/ExSFfoxHAuF6MacuQSvEXy2gFcNWP1ebjkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028