UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EhEQh/saG9iPghfGpawUXkSW0kxaZjPt5B9aaDhfdaI=' 
WHERE 
  key_id = 'a2e2a9268a4ee3c27af55c313d98b2244352712ee5e62c2cfcaffc5e0ca14771' 
  AND (
    token = 'EhEQh/saG9iPghfGpawUXkSW0kxaZjPt5B9aaDhfdaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024