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

Query time 0.00044