UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ny+waq9KkQrB4/XFUgXgUlE1iqSMFQ3YNpn9sBSRLcc=' 
WHERE 
  key_id = '683c8339f6ca0b8ff4c198d4f268350a43cd6656ca28a0bcf99e85e0fa2e8464' 
  AND (
    token = 'Ny+waq9KkQrB4/XFUgXgUlE1iqSMFQ3YNpn9sBSRLcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026