UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x9/VgtDTKuBtqWcJzvMZNsLcHNUaglZKIU+WfNoHtSY=' 
WHERE 
  key_id = '82c2839523113439dd93a626ad0f02508d3cd6277fda5ea72cdf2d436a507b47' 
  AND (
    token = 'x9/VgtDTKuBtqWcJzvMZNsLcHNUaglZKIU+WfNoHtSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036