UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e1ubG1L+XW7act1af4OQTKPIufbopZ1fo5GCK/DxKHE=' 
WHERE 
  key_id = 'e877548cedceb88c22b1872efa04610bf7220f6413803fcee5c233a0e1d660ec' 
  AND (
    token = 'e1ubG1L+XW7act1af4OQTKPIufbopZ1fo5GCK/DxKHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046