UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P/Z/AAhbdHe6a8hrDs5piwNlzxh7CfxQsn1WRnbv3wQ=' 
WHERE 
  key_id = '7be977e689d89081396b6cfc6103aae5b58d24bfaad44c5681127300e3b3e1bf' 
  AND (
    token = 'P/Z/AAhbdHe6a8hrDs5piwNlzxh7CfxQsn1WRnbv3wQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060