UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z7itulaJRoBOt3uQQpN/UH8axuXNS4xi48YeG1+LsHM=' 
WHERE 
  key_id = '0f9a36089979f32998737eb6f045342cbf655f84a5dec275d53580fe34268834' 
  AND (
    token = 'z7itulaJRoBOt3uQQpN/UH8axuXNS4xi48YeG1+LsHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025