UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W3lhcMYP07cgCDoHPlxLQI7kg68SxmqcC8fIu+EQVl8=' 
WHERE 
  key_id = '686412b9de0853238e52c968e7b64287874d0126a215bbcb9db0cbe8c18b27f8' 
  AND (
    token = 'W3lhcMYP07cgCDoHPlxLQI7kg68SxmqcC8fIu+EQVl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032