UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cx3R0oeimpGsbraBkvUNEdDjanfJYoajm0tHKP1EWoo=' 
WHERE 
  key_id = '5ddc1ad3aecd2b87921ec7452c3394e4ec2874825dcc5748de7f5f0809b84554' 
  AND (
    token = 'cx3R0oeimpGsbraBkvUNEdDjanfJYoajm0tHKP1EWoo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040