UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b6gHUs/QTo3nG4bRbyKsOjcX+HWSSxNikx6tRe8Z5H4=' 
WHERE 
  key_id = '9e5643e0e8ceec06c1bb78e54d2ae894c1834796a945e497ce1091afc12008c2' 
  AND (
    token = 'b6gHUs/QTo3nG4bRbyKsOjcX+HWSSxNikx6tRe8Z5H4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040