UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GEUGVkt45nZloHcFrpB/wrIEmMAjEo19MHLMJHEZsp8=' 
WHERE 
  key_id = '501090578830b0c9c7a022ebd5e099bfe337b6340ccf4113574a317a570aa7dd' 
  AND (
    token = 'GEUGVkt45nZloHcFrpB/wrIEmMAjEo19MHLMJHEZsp8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045