UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rHTRD5iTn0iRrZ92T/up/U6M7JlspjHEkdqJDWGRIIo=' 
WHERE 
  key_id = '7a63fa38684827497bf1be33d88d7c64b42d1b8c39561033ef6ee5f9cb9a72d6' 
  AND (
    token = 'rHTRD5iTn0iRrZ92T/up/U6M7JlspjHEkdqJDWGRIIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031