UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3m4BDJcREJPpO0pqneGNVWE0Ga66Z69ghng/ix+CaoA=' 
WHERE 
  key_id = '92ef17fa97c6d780096d3433adf0cae022cbc891bf338ec239b059e30e4116d6' 
  AND (
    token = '3m4BDJcREJPpO0pqneGNVWE0Ga66Z69ghng/ix+CaoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036