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

Query time 0.00034