UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hsQfnNrE1KkFm2bewCGaznLUZDGv3wYpf+9frhD6iEw=' 
WHERE 
  key_id = '61d120d4d547df745b524fd869b941edf95ace872829b8e240927a135d1c6019' 
  AND (
    token = 'hsQfnNrE1KkFm2bewCGaznLUZDGv3wYpf+9frhD6iEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040