UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z/I+StFVqSMx6WEuJzXTKixQZOV8s2J+w/GQ7ssLsUU=' 
WHERE 
  key_id = '06982a650a7375995e40bee9894d3cafa0da72a718f6357dcf51d6f6b8da2789' 
  AND (
    token = 'Z/I+StFVqSMx6WEuJzXTKixQZOV8s2J+w/GQ7ssLsUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024