UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ADHODi9ixAXQcWnB7m+t0fDImnt9bW2m0GPWncRlubU=' 
WHERE 
  key_id = 'ac756d177b826e0b075b800d25df455bc9b213483b8dd81b984eaeb68d103072' 
  AND (
    token = 'ADHODi9ixAXQcWnB7m+t0fDImnt9bW2m0GPWncRlubU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042