UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BaNDYgpdcb9urLOh9kogyQLB6rIcbplZit8ycb0DglE=' 
WHERE 
  key_id = '0843a9db0351fe75b4a59349af2e25c24836e332bbdc5f765a5c357e485c1e6c' 
  AND (
    token = 'BaNDYgpdcb9urLOh9kogyQLB6rIcbplZit8ycb0DglE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036