UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dFG8fXQbU7p0QUcOpKITtarkoY+48WMTIRY6dkXDAJY=' 
WHERE 
  key_id = '413d5130b99c814b824a5335e23a3f0502f75645c758973a966dfd9b9a9977f1' 
  AND (
    token = 'dFG8fXQbU7p0QUcOpKITtarkoY+48WMTIRY6dkXDAJY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046