UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xbD568PHkV4I4sG4T5PTnH+W1aOwaML37M6htD+UITM=' 
WHERE 
  key_id = '7e9e12d36f5bcc66a32b1107a450f4d00a0d9827d459d81587188a26014c88d6' 
  AND (
    token = 'xbD568PHkV4I4sG4T5PTnH+W1aOwaML37M6htD+UITM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028