UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HsLGiSdr3OBEoFAoZree2i7tUTmgKij6RQPFKjyiP6g=' 
WHERE 
  key_id = 'a6451fb9c04adc3138b348808f0e305291e07757d0939b2853b43104295bd380' 
  AND (
    token = 'HsLGiSdr3OBEoFAoZree2i7tUTmgKij6RQPFKjyiP6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019