UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c1m+cNVfX60T5x4F9Qp4IhFM2rvjAin9sWON4UpSYIk=' 
WHERE 
  key_id = '89dee19634821e632870e75992fbe7b43e0e99621b62e979d4e22a2d16db9b69' 
  AND (
    token = 'c1m+cNVfX60T5x4F9Qp4IhFM2rvjAin9sWON4UpSYIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035