UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6kgZKcLMdtVRmrsyIylIVW6ByxE04oKwYhxlGxI6FSc=' 
WHERE 
  key_id = 'e8655f77113aaa41ad0250be2809dbeaf39cf5ffa9df791c914e707198f42798' 
  AND (
    token = '6kgZKcLMdtVRmrsyIylIVW6ByxE04oKwYhxlGxI6FSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028