UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bIzn0wXbjihihx+KgPUxc6ZgK7zy3dYAjhWDFffgPW8=' 
WHERE 
  key_id = '419c7bf3dc575577657b4467f4d3083c828d481971ad6c26761b9ed1109b79f7' 
  AND (
    token = 'bIzn0wXbjihihx+KgPUxc6ZgK7zy3dYAjhWDFffgPW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053