UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7r/QJDLALpL+m/twIjc/8EAYh36xnWa8in0ZQ2bCegU=' 
WHERE 
  key_id = 'dbf9f97a12e8064284106bde00db4d35cb75a9ca52b4476827d75e773a53fd3d' 
  AND (
    token = '7r/QJDLALpL+m/twIjc/8EAYh36xnWa8in0ZQ2bCegU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029