UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oOnIMYgI3XTfKuAbWB0VRiaRK74e9/i4RUHt5suO7IY=' 
WHERE 
  key_id = '7851ef369c0a5b54121ee681802671ca63b5e720962750ecf880a2baf0943f59' 
  AND (
    token = 'oOnIMYgI3XTfKuAbWB0VRiaRK74e9/i4RUHt5suO7IY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043