UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+u6T1tESGP9pF/qX+BL7mbesI+2JZZTJhday5M0Wais=' 
WHERE 
  key_id = '4adfc69a44beff19c1ae1b426f2b554fab247471f384dec42f6efadfc50171c5' 
  AND (
    token = '+u6T1tESGP9pF/qX+BL7mbesI+2JZZTJhday5M0Wais=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038